package com.sphd.emanu.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.goods.Commodity;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/7/26 --19:46.
 * @Email 87683202@qq.com
 */
public class GoodsFragmentAdapter extends BaseQuickAdapter<Commodity, BaseViewHolder> {

    public GoodsFragmentAdapter(@LayoutRes int layoutResId, @Nullable List<Commodity> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Commodity item) {
        helper
                .addOnClickListener(R.id.layout_commdity)
                .addOnClickListener(R.id.layout_stronge_set)
                .setText(R.id.commondity_name, item.getName())
                .setText(R.id.commondity_category_storge,"分类名称:"+ item.getCategoryName() + "\t\t" + "当前库存:" + item.getStockDaily().getCurrentStock())
                .setText(R.id.commondity_touch_no, String.valueOf(item.getStockDaily().getPv()))
                .setText(R.id.commondity_set_storge, String.valueOf(item.getReserveStock()));
    }
}
